# 定义手机类
class Phone(object):
    def __init__(self, brand, color):
        self.brand = brand
        self.color = color

    def show(self):
        print(self.brand, self.color)


# 外部访问属性
phone1 = Phone("小米", "blue")
print(phone1.brand, phone1.color)


# 类名不能直接访问对象属性
# print(Phone.brand)

# 定义Student类
class Student(object):
    # 所有学生都在同一所学校
    school_name = "黑马程序员"


# print(Student.school_name)
Student.school_name = "白马程序员"
stu1 = Student()
stu2 = Student()
# 所有对象都可以获取到类属性
# 当对象拿到类属性时，类属性就转化为了对象属性
# print(stu1.school_name)
stu1.school_name = "黑马程序员"
print(stu1.school_name)
print(stu2.school_name)

print(Student.school_name)
